package greedy;

import java.util.Arrays;

/**
 * @author way
 * @create 2025-02-24 20:42
 */
public class _455_findContentChildren {
    public int findContentChildren(int[] g, int[] s) {
        Arrays.sort(g);
        Arrays.sort(s);
        int count = 0;
        int sIndex = s.length - 1;
        for (int i = g.length - 1; i >= 0; i--) {
            if (sIndex >= 0 && s[sIndex] >= g[i]) {
                count++;
                sIndex--;
            }

        }
        return count;
    }
}
